﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class TriggerCollisionExit : TriggerBase
{
    public LayerMask triggerLayer;

    public override void InitTrigger()
    {
        base.InitTrigger();
    }

    void OnCollisionExit2D(Collision2D collision2d)
    {
        Debug.LogError("collision exit 2d " + collision2d.gameObject.name);
        if (Util.IsInLayerMask(collision2d.gameObject.layer, triggerLayer))
        {
            OnTrigger();
        }
    }

    void OnTriggerExit2D(Collider2D collider2D)
    {
        Debug.LogError("collider2D exit 2d " + collider2D.gameObject.name);
        if (Util.IsInLayerMask(collider2D.gameObject.layer, triggerLayer))
        {
            OnTrigger();
        }
    }
}
